package com.rgst.dto;

/**
 * Created by tancw on 2019/11/24.
 */
public class Result<T> {
    private String code;
    private String msg;
    private boolean success;
    public T Data;

    public Result(String code, String msg, boolean success) {
        this.code = code;
        this.msg = msg;
        this.success = success;
    }

    public Result(String code, String msg, boolean success, T data) {
        this(code, msg, success);
        Data = data;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return Data;
    }

    public void setData(T data) {
        Data = data;
    }

    public String getMessage(){
        return this.msg;
    }

    public static Result success(Object data) {
        return new Result("0", "成功", true, data);
    }

    public static Result error(String message) {
        return new Result("-1", message, false, null);
    }
}
